﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/MasterPage.Master" AutoEventWireup="true" CodeBehind="PhieuThuePhong_View.aspx.cs" Inherits="QLKS.Views.PhieuThuePhong_View" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </cc1:ToolkitScriptManager>
    <div class="title-right"><span></span>Phiếu thuê phòng</div>
    <ul class="button">
        <li><asp:LinkButton style="background: url('/Content/themes/add_bt.png') no-repeat 5px #E0DEDE; " ID="btnNew" runat="server" onclick="btnNew_Click"><span></span>Thêm</asp:LinkButton></li>
        <li><asp:LinkButton style="background: url('/Content/themes/del_bt.png') no-repeat 5px #E0DEDE; " ID="btnDelete" runat="server" onclick="btnDelete_Click" OnClientClick="return confirm('Bạn có thực sư muốn xóa dữ liệu này??');"><span></span>Xóa</asp:LinkButton></li>
        <li><asp:LinkButton style="background: url('/Content/themes/fitx_bt.png') no-repeat 5px #E0DEDE; " ID="btnEdit" runat="server" onclick="btnEdit_Click"><span></span>Sửa</asp:LinkButton></li>
        <li><asp:LinkButton style="background: url('/Content/themes/sav_bt.png') no-repeat 5px #E0DEDE; " ID="btnSave" runat="server" onclick="btnSave_Click" OnClientClick="return checkInput();" ><span></span>Lưu</asp:LinkButton></li>
        <li><asp:LinkButton style="background: url('/Content/themes/can_bt.png') no-repeat 5px #E0DEDE; " ID="btnCancel" runat="server" onclick="btnCancel_Click"><span></span>Hủy</asp:LinkButton></li>
    </ul>
    <asp:Panel ID="pnlMain" runat="server" CssClass="swap-product">
        <asp:GridView ID="gvMain" runat="server" AutoGenerateColumns="False" GridLines="None" 
            AllowPaging="True"  AllowSorting="True" CssClass="list-grid" ShowHeaderWhenEmpty="true"
            onpageindexchanging="gvMain_PageIndexChanging" onrowdatabound="gvMain_RowDataBound" onsorting="gvMain_Sorting" >
            <Columns>
                <asp:TemplateField>
                    <HeaderStyle Width="20px"/>
					<ItemStyle Width="20px"/>
					<HeaderTemplate>
						<asp:CheckBox ID="chkall" Runat="server" TextAlign="Left" />
					</HeaderTemplate>
					<ItemTemplate>
						<asp:CheckBox ID="chkid" Runat="server" TextAlign="Left" />
					</ItemTemplate>
					<HeaderStyle HorizontalAlign="Left" />
				</asp:TemplateField>
				<asp:TemplateField HeaderText="STT">
					<ItemStyle Width="20px" />
					<HeaderStyle Width="20px"/>
					<ItemTemplate>
						<%# Container.DataItemIndex + 1 %>
					</ItemTemplate>
				</asp:TemplateField>
				<asp:TemplateField Visible="false">
					<ItemTemplate>
						<asp:Label ID="lblID" runat="server" Text='<%#Bind("MaPhieuThuePhong") %>'></asp:Label>
					</ItemTemplate>
				</asp:TemplateField>
				<asp:BoundField DataField="PhongThue.TenPhong" HeaderText="Phòng thuê" SortExpression="PhongThue.TenPhong" >
					<ItemStyle Width = "150" CssClass="name" />
				</asp:BoundField>
                <asp:BoundField DataField="NgayThuePhong" HeaderText="Ngày thuê phòng" SortExpression="NgayThuePhong" >
				</asp:BoundField>
                <asp:BoundField DataField="GhiChu" HeaderText="Ghi chú" >
				</asp:BoundField>
            </Columns>
        </asp:GridView>
    </asp:Panel>
    <asp:Panel ID="pnlUpdate" runat="server" CssClass="swap-product" Visible="false" >
        <table style="width:100%" border="0" class="list-update">
            <tr>
				<td style="width:20%;" align="right">Phong thuê:</td>
				<td>
                    <asp:DropDownList ID="ddlLoaiPhong" runat="server" Width="130px" CssClass="combobox" AutoPostBack="True" 
                        onselectedindexchanged="ddlLoaiPhong_SelectedIndexChanged">
                    </asp:DropDownList>
					<asp:DropDownList ID="ddlPhongThue" runat="server" Width="175px" CssClass="combobox" style="margin-left: 3px;" >
                    </asp:DropDownList>
				</td>
			</tr>
            <tr>
				<td style="width:20%;" align="right">Ngày thuê phòng:</td>
				<td>
					<asp:TextBox ID="txtNgayThuePhong" runat="server" MaxLength="10" CssClass="textbox" ReadOnly="true" Width="300px"></asp:TextBox>
				</td>
			</tr>
            <tr>
                <td style="width:20%;" align="right">Khách hàng:</td>
				<td>
				    <asp:LinkButton runat="server" ID="btnThemKhachHang" Text="Thêm khách hàng"></asp:LinkButton>
				</td>
            </tr>
            <tr>
				<td style="width:20%;" align="right">Ghi chú:</td>
				<td>
					<asp:TextBox ID="txtGhiChu" runat="server" MaxLength="500" TextMode="MultiLine" Rows="5" CssClass="textbox" Width="300px"></asp:TextBox>
				</td>
			</tr>
            <tr>
                <td colspan="2">
                <asp:UpdatePanel ID="upDetail" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                    <asp:Panel ID="pnlDetail" runat="server" CssClass="swap-product">
                        <asp:GridView ID="gvDetail" runat="server" AutoGenerateColumns="False" GridLines="None" 
                            CssClass="list-grid" ShowHeaderWhenEmpty="true">
                            <Columns>
				                <asp:TemplateField HeaderText="STT">
					                <ItemStyle Width="20px" />
					                <HeaderStyle Width="20px"/>
					                <ItemTemplate>
						                <%# Container.DataItemIndex + 1 %>
					                </ItemTemplate>
				                </asp:TemplateField>
				                <asp:TemplateField Visible="false">
					                <ItemTemplate>
						                <asp:Label ID="lblID" runat="server" Text='<%#Bind("KhachHangID") %>'></asp:Label>
					                </ItemTemplate>
				                </asp:TemplateField>
				                <asp:BoundField DataField="KhachHang.TenKhachHang" HeaderText="Khách hàng" >
					                <ItemStyle Width = "150" CssClass="name" />
				                </asp:BoundField>
                                <asp:BoundField DataField="KhachHang.LoaiKhachHang.TenLoaiKhachHang" HeaderText="Loại khách hàng" >
					                <ItemStyle Width = "150" CssClass="name" />
				                </asp:BoundField>
                                <asp:BoundField DataField="KhachHang.CMND" HeaderText="CMND" >
				                </asp:BoundField>
                                <asp:BoundField DataField="KhachHang.DienThoai" HeaderText="Điện thoại" >
				                </asp:BoundField>
                                <asp:BoundField DataField="KhachHang.DiaChi" HeaderText="Địa chỉ" >
				                </asp:BoundField>
                            </Columns>
                        </asp:GridView>
                    </asp:Panel>
                    </ContentTemplate>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="btnSelect" />
                    </Triggers>
                </asp:UpdatePanel>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <cc1:ModalPopupExtender ID="mpePopup" BehaviorID="mpe" runat="server" 
        PopupControlID="pnlPopup" TargetControlID="btnThemKhachHang" BackgroundCssClass="modalBackground">
    </cc1:ModalPopupExtender>
    <asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
        <div class="header">Chọn khách hàng</div>
        <div class="body swap-product">
            <table style="width:100%" border="0" class="list-update">
                <tr>
				    <td style="width:20%;" align="right">Tên khách hàng:</td>
				    <td>
					    <asp:TextBox ID="txtTenKhachHang" runat="server" MaxLength="100" CssClass="textbox required" Width="300px"></asp:TextBox>
				    </td>
			    </tr>
                <tr>
				    <td style="width:20%;" align="right">Loại khách hàng:</td>
				    <td>
					    <asp:DropDownList ID="ddlLoaiKhachHang" runat="server" Width="308px" CssClass="combobox">
                        </asp:DropDownList>
				    </td>
			    </tr>
                <tr>
				    <td style="width:20%;" align="right">CMND/ hộ chiếu:</td>
				    <td>
					    <asp:TextBox ID="txtCMND" runat="server" MaxLength="20" CssClass="textbox required" Width="300px"></asp:TextBox>
				    </td>
			    </tr>
                <tr>
				    <td style="width:20%;" align="right">Điện thoại:</td>
				    <td>
					    <asp:TextBox ID="txtDienThoai" runat="server" MaxLength="50" CssClass="textbox" Width="300px"></asp:TextBox>
				    </td>
			    </tr>
                <tr>
				    <td style="width:20%;" align="right">Email:</td>
				    <td>
					    <asp:TextBox ID="txtEmail" runat="server" MaxLength="50" CssClass="textbox" Width="300px"></asp:TextBox>
				    </td>
			    </tr>
                <tr>
				    <td style="width:20%;" align="right">Địa chỉ:</td>
				    <td>
					    <asp:TextBox ID="txtDiaChi" runat="server" MaxLength="100" CssClass="textbox" Width="300px"></asp:TextBox>
				    </td>
			    </tr>
                <tr>
                    <td colspan="2" align="center">
                        <asp:Button ID="btnSelect" runat="server" Text="Thêm khách hàng" OnClick="btnSelect_Click" />
                        <asp:Button ID="btnHide" runat="server" Text="Đóng" OnClientClick="return HideModalPopup()" />
                    </td>
                </tr>
            </table>
        </div>
    </asp:Panel>

    <script type="text/javascript">
        function checkInput() {
            var isValid = true;
            $('.list-update input.required').each(function () {
                if ($.trim($(this).val()) == '') {
                    isValid = false;
                    $(this).css({ "border": "1px solid red", "background": "#FFCECE" });
                }
                else {
                    $(this).css({ "border": "", "background": "" });
                }
            });
            
            return isValid;
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" runat="server" contentplaceholderid="Menu">
<dl>
    <dt class="currentac"><a href="#">QUẢN LÝ PHÒNG</a></dt>
    <dd  class="currentac" style="display: block;">
        <ul>
            <li ><a href="Index.aspx">Tổng quan</a></li>
            <li class="currentac"><a href="PhieuThuePhong_View.aspx">Phiếu thuê phòng</a></li>
            <li><a href="PhieuTraPhong_View.aspx">Phiếu trả phòng</a></li>
            <li><a href="HoaDon_View.aspx">Hóa đơn</a></li>
        </ul>
    </dd>
    <dt  ><a class="" href="#">HỆ THỐNG</a></dt>
    <dd style="display: none;">
        <ul>
            <li ><a href="DMPhong_View.aspx">Danh mục phòng</a></li>
            <li ><a href="DMKhachHang_View.aspx">Danh mục khách hàng</a></li>
            <li><a href="DMLoaiPhong_View.aspx">Danh mục loại phòng</a></li>
            <li><a href="DMLoaiKhachHang_View.aspx">Danh mục loại khách hàng</a></li>
            <li ><a href="DMNguoiDung_View.aspx">Danh mục người dùng</a></li>
            <li ><a href="ThamSoHeThong_View.aspx">Tham số hệ thống</a></li>
        </ul>
    </dd>
    <dt class=""><a href="#">BÁO CÁO</a></dt>
    <dd  style="display: none;">
        <ul>
            <li><a href="BaoCaoDoanhThuTheoLoaiPhong_View.aspx">Doanh thu theo loại phòng</a></li>
            <li><a href="BaoCaoMatDoSuDungPhong_View.aspx">Mật độ sử dụng phòng</a></li>
        </ul>
    </dd>
</dl>
</asp:Content>